package com.fundcrawler.web;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        
        // 1. 映射 classpath 下的自定义目录
        registry.addResourceHandler("/assets/**")
                .addResourceLocations("classpath:/my-static/");

        // 2. 映射本地磁盘文件目录（如用户上传的文件）
        registry.addResourceHandler("/uploads/**")
                .addResourceLocations("file:C:/upload-files/");

        // 3. 映射多个路径
        registry.addResourceHandler("/static/**")
                .addResourceLocations("classpath:/static/", "classpath:/public/");

        // 4. 映射 Swagger UI（如果使用）
        registry.addResourceHandler("/swagger-ui/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
    }
}
